import os;
import re;

#列出指定目录下，所有文件和文件夹
def getFileList(dirpath='./'):
	os.chdir(dirpath);
	files=os.listdir();
	#print(files);
	result=filter(lambda v:os.path.isdir(v)==False and v[:1]!='.',files);
	return list(result);

#指定目录
files=getFileList(r'/Users/jiangjun/Desktop/21马瑞芳品读《红楼梦》');
#指定模式
pattern=re.compile('^\d{2}、.*');
  
# for v in files:
# 	result=re.match(pattern,v)
# 	if(result):
# 		print(v,'将修改为：');
# 		newname='0'+result.group();   
# 		print(newname);
# 		#os.rename(v,newname);

for v in files:
	newname=re.sub('请加微信：xiong911911911','',v);
	print(v,'将修改为：');
	print(newname);		
	os.rename(v,newname);

